package com.aliyun.solutions.demo.wanxiang.model;

import lombok.Data;

/**
 * 结果
 *
 * @author solution
 * @date 2024/12/04
 */
@Data
public class ApiResult<T> {

    /**
     * 数据
     */
    private T data;
    /**
     * 成功
     */
    private Boolean success;
    /**
     * 消息
     */
    private String message;

    public static <T> ApiResult<T> success(T data) {
        ApiResult<T> apiResult = new ApiResult<>();
        apiResult.setData(data);
        apiResult.setSuccess(true);
        return apiResult;
    }

    public static <T> ApiResult<T> fail(String message) {
        ApiResult<T> apiResult = new ApiResult<>();
        apiResult.setMessage(message);
        apiResult.setSuccess(false);
        return apiResult;
    }
}